package cn.dt.person.service;

import cn.dt.person.mapper.PersonMapper;
import cn.dt.person.pojo.Person;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class PersonServiceImpl implements PersonService{
    @Resource
    PersonMapper mapper;

    //查询所有
    @Override
    public List<Person> getSelectPersonlist() {
        return mapper.selectByExample(null);
    }
    //根据主键查询信息
    @Override
    public Person getSelectPersonById(Integer id) {
        return mapper.selectByPrimaryKey(id);
    }
    //添加
    @Override
    public int getAddPerson(Person person) {
        return mapper.insertSelective(person);
    }
    //修改
    @Override
    public int getDelPerson(Integer id) {
        return mapper.deleteByPrimaryKey(id);
    }



}
